<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>Enabling the remote API - client side</title>
<link rel="stylesheet" type="text/css" href="../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../index.html" TARGET="_top"><img src="images/homeImg.png"></a></p>


<h1>Enabling the remote API - client side</h1>

<p class=warningBox>The remote API, or  <em>legacy remote API</em>, should not be mixed-up with the <a href="b0RemoteApiOverview.htm">B&Oslash;-based remote API</a>, which is a newer version of the remote API that is more flexible, easier to use and most importantly, much simpler to extend.</p>

<p class=warningBox>All units going to, or coming from the <a href="apiFunctions.htm">API</a> are in meters, kilograms, seconds and <strong>radians</strong>  or a combination of those (unless otherwise explicitly indicated).<br>
</p>


<br>
<br>

<table class=subsectionTable><tr class=subsectionTd><td class=subsectionTd>
<a name="c"></a>C/C++ client
</td></tr></table> 


<p>To use the remote API functionality in your C/C++ application, just include following C-language files in your project:</p>

<li>extApi.h</li>
<li>extApi.c</li>
<li>extApiPlatform.h (contains platform specific code)</li>
<li>extApiPlatform.c (contains platform specific code)</li>

<p>Above files are located in CoppeliaSim's installation directory, under <em>programming/remoteApi</em>. Make sure you have defined <strong>NON_MATLAB_PARSING</strong> and <strong>MAX_EXT_API_CONNECTIONS=255</strong> (and optionally <strong>DO_NOT_USE_SHARED_MEMORY</strong>) as a preprocessor definition. To enable the remote API on the client side (i.e. your application), call<em> <a href="remoteApiFunctions.htm#simxStart">simxStart</a></em>. See the <em>bubbleRobClient</em> project in the <em>programming</em> directory for an example. <a href="remoteApiFunctions.htm">This page</a> lists and describes all supported  C/C++ remote API functions. CoppeliaSim remote API functions can easily be recognized from their &quot;simx&quot;-prefix.
</p>

<br>
<br>

<table class=subsectionTable><tr class=subsectionTd><td class=subsectionTd>
<a name="python"></a>Python client
</td></tr></table> 

<p>To use the remote API functionality in your Python script, you will need following 3 items:</p>

<li>sim.py</li>
<li>simConst.py</li>
<li>remoteApi.dll, remoteApi.dylib or remoteApi.so (depending on your target platform)</li>

<p>Above files are located in CoppeliaSim's installation directory, under <em>programming/remoteApiBindings/python</em>. You might have to build the remoteApi shared library yourself (using <em>remoteApiSharedLib.vcproj</em> or <em>makefile</em>) if not already built. In that case, make sure you have defined <strong>NON_MATLAB_PARSING</strong> and <strong>MAX_EXT_API_CONNECTIONS=255 </strong>(and optionally <strong><strong>DO_NOT_USE_SHARED_MEMORY</strong></strong>) as a preprocessor definition.</p>

<p>Once you have above elements in a directory known to Python, call <em>import sim</em> to load the library. To enable the remote API on the client side (i.e. your application), call <a href="remoteApiFunctionsPython.htm#simxStart"><em>sim.simxStart</em></a>. See the <em>simpleTest.py</em> script in the <em>programming/remoteApiBindings/python</em> directory for an example. <a href="remoteApiFunctionsPython.htm">This page</a> lists and describes all supported  Python remote API functions. CoppeliaSim remote API functions can easily be recognized from their &quot;simx&quot;-prefix.
</p>


<br>
<br>

<table class=subsectionTable><tr class=subsectionTd><td class=subsectionTd>
<a name="java"></a>Java client
</td></tr></table> 


<p>To use the remote API functionality in your Java application, you will need following 2 items:</p>

<li>package <em>coppelia</em> (containing 12 Java classes)</li>
<li>remoteApiJava.dll, libremoteApiJava.dylib or libremoteApiJava.so (depending on your target platform)</li>

<p>Above files are located in CoppeliaSim's installation directory, under <em>programming/remoteApiBindings/java</em>. You might have to build the remoteApiJava shared library yourself (using <em>remoteApiSharedLibJava.vcproj</em> or <em>remoteApiSharedLibJava_Makefile</em>) if not already built. In that case, make sure you have defined <strong>NON_MATLAB_PARSING</strong> and <strong>MAX_EXT_API_CONNECTIONS=255</strong>  (and optionally <strong>DO_NOT_USE_SHARED_MEMORY</strong>) as a preprocessor definition.</p>

<p>Once you have above elements in a directory known to Java, compile your application with <em>myAppName.java</em> with <em>javac myAppName.java</em>. In your application, make sure to import the classes that you use with <em>import coppelia.className</em>, then call <em>remoteApi sim = new remoteApi() </em> to load the library. To enable the remote API on the client side (i.e. your application), call <a href="remoteApiFunctionsJava.htm#simxStart"><em>sim.simxStart</em></a>.   See the <em>simpleTest.java</em> program in the <em>programming/remoteApiBindings/java</em> directory for an example.<a href="remoteApiFunctionsJava.htm">This page</a> lists and describes all supported  Java remote API functions. CoppeliaSim remote API functions can easily be recognized from their &quot;simx&quot;-prefix.
</p>

<p>You might also have  to add the folder to the system path. In Linux for instance, you could call: e<em>xport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`</em> before executing your Java application.</p>


<br>
<br>

<table class=subsectionTable><tr class=subsectionTd><td class=subsectionTd>
<a name="matlab"></a>Matlab client
</td></tr></table> 

<p>To use the remote API functionality in your Matlab program, you will need following 3 items:</p>

<li>remoteApiProto.m</li>
<li>remApi.m</li>
<li>remoteApi.dll, remoteApi.dylib or remoteApi.so (depending on your target platform)</li>

<p>Above files are located in CoppeliaSim's installation directory, under <em>programming/remoteApiBindings/matlab</em>. You might have to build the remoteApi shared library yourself (using <em>remoteApiSharedLib.vcproj</em> or <em>remoteApiSharedLib_Makefile</em>) if not already built. </p>

<p> Once you have above elements in Matlab's current folder, call <em>sim=remApi('remoteApi') </em>to build the object and load the library. To enable the remote API on the client side (i.e. your application), call <a href="remoteApiFunctionsMatlab.htm#simxStart"><em>sim.simxStart</em></a>.   See the <em>simpleTest.m</em> program in the <em>programming/remoteApiBindings/matlab</em> directory for an example.<a href="remoteApiFunctionsMatlab.htm">This page</a> lists and describes all supported  Matlab remote API functions. CoppeliaSim remote API functions can easily be recognized from their &quot;simx&quot;-prefix.</p>
<p>Make sure your Matlab uses the same bit-architecture as the remoteApi library: 64bit Matlab with 32bit remoteApi library will not work, and vice-versa!</p>

<p>
If you had to rebuild the remoteApi library, you might have to regenerate the prototype file (<em>remoteApiProto.m</em>): first, make sure you have a compiler that Matlab recognizes. You might have to call <em>mex -setup</em>. Then, type <em>loadlibrary('remoteApi','extApi.h','mfilename','remoteApiProto')</em>.</p>



<br>
<br>



<table class=subsectionTable><tr class=subsectionTd><td class=subsectionTd>
<a name="octave"></a>Octave client
</td></tr></table> 

<p>To use the remote API functionality in your Octave program, you will need following 2 items:</p>

<li>remApiSetup.m</li>
<li>remApi.oct</li>

<p>Above  files are located in CoppeliaSim's installation directory, under <em>programming/remoteApiBindings/octave</em>. You might have to build the remApi.oct shared library yourself, if not already build.  In that case, make sure to place all the content of <em>programming/remoteApi</em> and <em>programming/include</em> into that directory before calling <em>buildWin, buildLin or buildMac</em> from the Octave command line.</p>

<p> Once you have above elements in Octave's current folder, call <em>sim=remApiSetup() </em>to load the library and bind the functions. To enable the remote API on the client side (i.e. your application), call <a href="remoteApiFunctionsOctave.htm#simxStart"><em>simxStart</em></a>.   See the <em>simpleTest.m</em> program in the <em>programming/RemoteApiBindings/octave</em> directory for an example.<a href="remoteApiFunctionsOctave.htm">This page</a> lists and describes all supported  Octave remote API functions. CoppeliaSim remote API functions can easily be recognized from their &quot;simx&quot;-prefix.</p>
<p>Make sure your Octave uses the same bit-architecture as the remoteApi library: 64bit Octave with 32bit remoteApi library will not work, and vice-versa!</p>


<br>
<br>




<table class=subsectionTable><tr class=subsectionTd><td class=subsectionTd>
<a name="lua"></a>Lua client
</td></tr></table> 

<p>To use the remote API functionality in your external Lua script (i.e. not inside of CoppeliaSim), you will need following item:</p>

<li>remoteApiLua.dll, remoteApiLua.dylib or remoteApiLua.so (depending on your target platform)</li>

<p>Above file is located in CoppeliaSim's installation directory, under <em>programming/remoteApiBindings/lua</em>. You might have to build the remoteApi shared library yourself (using <em>remoteApiLua.vcproj</em> or <em>makefile</em>) if not already built. In that case, make sure you have defined <strong>NON_MATLAB_PARSING</strong> and <strong>MAX_EXT_API_CONNECTIONS=255</strong>  (and optionally <strong>DO_NOT_USE_SHARED_MEMORY</strong>) as a preprocessor definition.</p>

<p>Once you have above element in a directory known to Lua, call <em>require 'remoteApiLua' </em> to load the library. To enable the remote API on the client side (i.e. your application), call <a href="remoteApiFunctionsLua.htm#simxStart"><em>simxStart</em></a>. See the <em>simpleTest.lua</em> script in the <em>programming/remoteApiBindings/lua</em> directory for an example. <a href="remoteApiFunctionsLua.htm">This page</a> lists and describes all supported  Lua remote API functions. CoppeliaSim remote API functions can easily be recognized from their &quot;simx&quot;-prefix.
</p>
<br>
<br>
 </tr>
 <tr>
   <td > 
 </tr>
</table> 
</div>  
  
  
</body>

</html>